<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <title>{$activity_info['jsonstr']['pageTitle']}</title>
    <link rel="stylesheet" type="text/css" href="{$Think.config.RESOURCEURL}wx_assets/scanforgift/css/index.css{$Think.config.RESOURCE_VER}" />
    <script src="{$Think.config.RESOURCEURL}wx_assets/scanforgift/js/remApp.js" type="text/javascript" charset="utf-8"></script>
   
    <script src="{$Think.config.RESOURCEURL}wx_assets/js/zepto.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="{$Think.config.RESOURCEURL}wx_assets/js/layer.m.js" type="text/javascript" charset="utf-8"></script>
    <script src="{$Think.config.RESOURCEURL}wx_assets/js/common.js{$Think.config.RESOURCE_VER}" type="text/javascript" charset="utf-8"></script>
    <script src="{$Think.config.RESOURCEURL}wx_assets/js/util.js" type="text/javascript" charset="utf-8"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script src="{$Think.config.RESOURCEURL}wx_assets/womenday/js/wx_share.js{$Think.config.RESOURCE_VER}" type="text/javascript" charset="utf-8"></script>
</head>
<style>
    .container
    {
        background: url({$activity_info.jsonstr.scanforgiftBackground.src}) no-repeat;
        background-position: 50% 50%;
        background-size:cover;
    }
</style>
<script type="text/javascript">
    var actId=$.util.getParamByObject("actId"),
    chanelId=$.util.getParamByObject("chanelId"),
    partake_id="{$partake_id}",
    customerId=$.util.getParam("customerId"),
    fromUserId=$.util.getParam("fromUserId"),
    fromUserIdstr="",
    params={actId:actId},
    geturl=function(method,bool,bool1){
        if(chanelId)params.chanelId=chanelId;
        if(bool1&&partake_id)params.partake_id=partake_id;
        fromUserIdstr=fromUserId?"&fromUserId="+fromUserId:"";
        if(!method)method="index";
        if(bool&&!fromUserId)
        fromUserIdstr="&fromUserId={$userId}";
        return "call.html?module=scanforgift&method="+method+fromUserIdstr+"&customerId="+customerId+"&params="+encodeURIComponent(JSON.stringify(params))
    },
    sharelink=geturl("index");
</script>
<script type="text/javascript">
    //是否参加过
    var code = "{$code}";
    //是否填写过
    var gain_status="{$gain_status}";       
</script>
<body>
    <input type="hidden" id="need_subscribe" value="{$activity_info['jsonstr']['need_subscribe']}">
    <input type="hidden" id="is_subscribe" value="{$activity_info['is_subscribe']}">
    <input type="hidden" id="closebtn" value="{$Think.config.RESOURCEURL}wx_assets/scanforgift/img/closebtn.png">
    <img id="ruleIMG" src="{$activity_info.jsonstr.followBackground.src}" alt="" style="display:none;">
    <div class="container">
        <div class="actbox">
            <volist name="activity_info.jsonstr.ruleImgs" id="value">
                <img src="{$value}" alt="">
            </volist> 
            <div class="btn-group">
                <a href="javascript:;" class="rulebtn">
                    <img src="{$activity_info.jsonstr.joinBtn.src}" alt="">
                </a>
                <if condition='$code eq "1"'>
                    <a href="javascript:;" class="grabbtn">
                        <img src="{$activity_info.jsonstr.progressBtn.src}" alt="">
                    </a>
                </if>  
            </div> 
        </div>
        
    </div>
</body>
<script src="{$Think.config.RESOURCEURL}wx_assets/scanforgift/js/index.js{$Think.config.RESOURCE_VER}" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var need_subscribe=$("#need_subscribe").val(),
        is_subscribe=$("#is_subscribe").val();
var baseUrl = '{$Think.config.SERVER_HOST}';
var shareData = {
        "title": "{$activity_info.title}",
        "desc": "{$activity_info.description}",
        "link": baseUrl+sharelink,
        "imgUrl": "{$activity_info.picurl}",
        "pkg": {
            "appId": '{$pkg.appId}',
            "timestamp": {$pkg['timestamp']?$pkg['timestamp']:'""'},
            "nonceStr": '{$pkg.nonceStr}',
            "signature": '{$pkg.signature}'
        },
        "hideOptionMenu":true
    }
$(function() {
    wx_share.init(shareData);

    $('.grabbtn').on("click",function(){
        var url=geturl("show",0,1);
        window.location.href=url;
    })

    $('.rulebtn').on('click', function() {
        if(need_subscribe != '2'&&is_subscribe != '1')
        {
            var url=geturl("guide");
            window.location.href=url;
        }
        else
        {
            var url=geturl("join_now");
            window.location.href=url;
        }
    })

})
</script>

</html>
